//var authApp=angular.module('authapp1', ["ngCookies",'ngFileUpload','ui.bootstrap']);

//此为定位页面所用
authApp.value('page','school_Fill');

authApp.controller("dataFillController",function($scope,$http,$getQueryString, $cookies){

    $scope.schoolId= $getQueryString('schoolId')
    $scope.schoolName= decodeURIComponent($getQueryString('schoolName'))
    $scope.accounttype = $cookies.get('accounttype')
	//针对此页面需要的参数 should edit

    $scope.list = []

    var queryMainApi=apis.queryItemListByExpert;//！！！should edit
	$scope.queryMain=function(){
		$http({
			method:'get',
			url:queryMainApi,
            params:{"schoolId": $scope.schoolId, 'schoolName': $scope.schoolName},
		}).success(function(response){
			if(response.code=="000000"){
                $scope.list = response.data
			}else{
				alert(response.errorMsg);
			}
		}).error(function(){
			alert("网络出现故障，请确认网络是否连接");
		})
    }
    
    $scope.turnTo = function(arraylist) {
      return window.location.href = '/zzpg/views/investiga/option_list.html?schoolId=' + arraylist.schoolId + '&itemId=' + arraylist.itemId+'&schoolName='+arraylist.schoolName
    }
    $scope.turnTo1=function(schoolId,itemId,index,firstName,schoolName, state){
		location.href="table42.html?schoolId="+schoolId+"&itemId="+itemId+"&index="+index+"&firstName="+toUnicode(firstName)+"&schoolName="+toUnicode(schoolName)+'&state='+state;
    }
    
    $scope.turnTo2 = function(arraylist) {
        return window.open( '/zzpg/views/investiga/fileInfo.html?schoolId=' + arraylist.schoolId)
    }
    $scope.queryMainApiCallBack = function(response) {
        
    //   $http({
    //         method:'get',
    //         url:apis.underSchoolFile ,
    //         params:{"school_id": schoolId, 'item_id': itemId},
    //     }).success(function(response){
    //       if(response.code=="000000"){
            
    //          //$scope.itemlist = response.data
    //       }else{
    //          alert(response.errorMsg);
    //       }
    //     }).error(function(){
    //       alert("网络出现故障，请确认网络是否连接");
    //     })
    }

    $scope.queryMain();
})


function toUnicode(str)
{
	return escape(str).replace(/%/g,"//").toLowerCase();
}